import Taro from '@tarojs/taro' ;

const funKeys = ['request','login'] ;

const ob ={} ;

function _loop(key){
  ob[key] = function (original) {
    let t = Object.assign({},original) ,
        goback = new Promise((s,j)=>{
          console.log('创建微信promise方法[%s]',key)
          console.log('方法的原始参数[%o]',original)
          t.success = (...args)=>s.apply(null,args)
          t.fail = (e)=>j(e)
        }).catch(err=>{
          console.log('微信方法[%s]创建失败',key)
          console.log(err)
        }) ;
    Taro[key].call(null , t)
    // Taro[key](t)
    return goback      
  }
}

funKeys.forEach(v=>_loop(v))

export default ob